<?php
/**
 * 阵容
 */
namespace app\sports\match\controller;

use app\common\BaseController;
use app\sports\match\service\BattleService;

class Battle extends BaseController
{
    /**
     * 获取比赛阵容
     */
    public function getBattleByMatchId()
    {
        $data = $this->request->post();
        $matchId = isset($data['match_id']) ? $data['match_id'] : 0;
        if (empty($matchId)) {
            $this->jsonReturn(-1, [], '比赛ID为空');
        }

        $service = new BattleService();
        $data = $service->getBattleByMatchId($matchId);

        $this->jsonReturn(0, $data);
    }

    /**
     * 获取比赛详情
     */
    public function getBattleDetailByMatchId()
    {
        $data = $this->request->post();
        $matchId = isset($data['match_id']) ? $data['match_id'] : 0;
        if (empty($matchId)) {
            $this->jsonReturn(-1, [], '比赛ID为空');
        }

        $service = new BattleService();
        $data = $service->getBattleDetailByMatchId($matchId);

        $this->jsonReturn(0, $data);
    }
}